Skip to content

Extend coof cascade eligibility to strategy.exit orders (KI-67)#98

Merged
luisleo526 merged 1 commit into
mainfrom
fix/ki67-cascade-gapjump
Jul 11, 2026
Merged

Extend coof cascade eligibility to strategy.exit orders (KI-67)#98
luisleo526 merged 1 commit into
mainfrom
fix/ki67-cascade-gapjump

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Summary

PR#95 gave calc_on_order_fills ENTRY orders cascade eligibility on the historical 4-tick path, but it never reached strategy.exit: the engine rolled 100% of exits placed by a mid-bar fill recalc — even those whose level sits at a remaining extreme. TradingView does not.

A clean-room probe (pf-probe-ki67-exitlim-midseg, 4,851 TV trades) pins the rule, Model S "R-cascade-gapjump" (4,848/4,850 = 99.96% event-level): after an intrabar fill at price p triggers a coof recalc, the emulator resumes the O→W1→W2→C proximity path from p. A priced strategy.exit placed at that recalc gap-fills same-bar at the in-flight leg-end waypoint when its level lies in the leg remainder (limits AND stops); fills same-bar at the exact level on subsequent legs; a terminal in-flight leg or off-path level rolls to next bar. The in-flight leg is read from the dispatch cursor's real position (price re-derivation is ambiguous at waypoint fills). Market/close and trailing cascade exits keep PR#95's extreme-waypoint reach; scope is narrowed to OrderType::EXIT (opposing raw strategy.order brackets keep PR#95 behavior — unpinned class, per review). Bar-magnifier path untouched.

Verification

  • New suite test_cascade_exit_gapjump (34 checks; 6 RED on base + 1 corrected POOC assertion whose old expectation encoded PR#95's own flagged residual, refuted by the probe's FRACSTP cells). ctest 96/96. REDs independently reproduced by fresh-context review.
  • pf-probe-ki67-exitlim-midseg: 36.8% → 98.8% raw, canonical excellent 100.0, exit/pnl P90 → 0.
  • pf-probe-coof-refill-depth: 85.7% → 99.8%, P90s → 0.
  • Coof cohort (fran/jenmb/delta/mrwick/wayward) byte-identical vs clean base (md5, verified twice independently); masayanfx + both KI-62 keepscratch probes byte-identical; 3commas standard sentinels byte-identical.
  • Corpus 252: 240/11/1 exact. Full 412-slug private sweep: 0 up / 0 down.

Known residuals (recorded, non-blocking per review)

  • 56-trade probe residual isolated to WP-control cells whose exit level is a dynamic bar-extreme (high/low) series re-arming intrabar — distinct mechanism, tracked as its own KI.
  • Cascade-exit × same-bar add coverage (PR#97) is a new combination with no dedicated probe; mechanism is membership-based and unit-tested.
  • Marketable-at-placement stays on the coof-suppress roll path (cohort-validated; pinned in test M1).

🤖 Generated with Claude Code

PR#95 gave calc_on_order_fills ENTRY orders cascade eligibility on the
historical 4-tick path but it never reached strategy.exit: the engine
rolled 100% of exits placed by a mid-bar fill recalc, even those whose
level sits at a remaining extreme. TradingView does not. A clean-room
probe (pf-probe-ki67-exitlim-midseg, 4,851 TV trades) pins the rule,
Model S "R-cascade-gapjump":

After an intrabar fill at price ap triggers a coof recalc, the emulator
resumes the O->W1->W2->C proximity path from ap. A priced exit placed at
that recalc is held on its in-flight leg's remainder; gap-fills same-bar
at the leg-end waypoint when its level lies in that remainder (limits
better than the level, stops worse); exact-level fills on every
subsequent leg; and a terminal in-flight leg (-> C) or off-path fill
rolls to the next bar. The in-flight leg is read from the dispatch
cursor's real position, not re-derived from the fill price (which is
ambiguous when the fill lands exactly on a waypoint). Market/close and
trailing cascade exits keep the plain extreme-waypoint reach; the
bar-magnifier path is scoped out.

Gates: ki67-exitlim-midseg 36.8% -> 98.8% (canonical 100.0, exit/pnl
p90 -> 0); coof-refill-depth 85.7% -> 99.8%; coof cohort byte-identical
(md5-verified fran/jenmb/delta/mrwick/wayward); corpus 240/11/1 zero
movement; R7 3commas sentinels byte-identical. A WP-control residual
(exit level = a dynamic high/low series) remains, distinct from the
fixed-level rule and within canonical tolerance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit 6abebad into main Jul 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant